﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace Haidou.Wpf.UI.ViewModel
{
	public abstract class ObservableObject : INotifyPropertyChanged
	{
		public event PropertyChangedEventHandler PropertyChanged;
		protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string name = null)
		{
			if (Equals(storage, value)) return false;
			storage = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
			return true;
		}
		protected void OnPropertyChanged([CallerMemberName] string n = null)
			=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(n));
	}

}
